fix(lsp): cold terminal requests; vendor rust-analyzer VFS#301
Merged
Conversation
|
Docs preview: https://vide.pascal-lab.net/preview/pr-301/ |
Server-side notify stays best-effort at rust-analyzer's abstraction level: configuration scans report Loaded, later disk/invalidate events report Changed, and OS watcher failures are logged rather than terminal for a generation. Remove the WatcherManager state machine, coverage revisions, ScanFailed, and WatcherStatus protocol. Workspace readiness follows content-scan Progress only, matching other LSPs that do not treat notify completeness as a readiness invariant.
Replace the self-grown vfs crate with an owned tinymist-style fork of rust-analyzer's `vfs` + `vfs-notify`, pinned to commit 5300ee2665. Adaptations for vide so far: - map `paths`/`stdx` onto `utils` - feature-gate the notify backend - document upstream and fork policy in UPSTREAM.md Hardlink identity is gone with the old Vfs implementation. Call sites across hir/ide/host still need a Phase 1 cutover to the new API (`Option<Vec<u8>>`, r-a Change shape, r-a loader Config).
Wire hir/ide/project-model and the LSP host to the vendored r-a VFS: - content is Option<Vec<u8>>; line endings live in the host map - loader Message matches r-a: Progress carries config_version and LoadingProgress; Loaded/Changed carry only files - generation readiness is gated solely by Progress::Finished - drop VFS hardlink identity and remap paths through FileId redirects - keep SV PathMatcher/FileSet partitioning and SOURCE_FILE_EXTENSIONS as intentional fork deltas - retain #301 cold-request terminal fallbacks and Loaded vs Changed provenance for workspace reload
Apply cargo fmt, satisfy clippy -D warnings, and update ide test fixtures to ChangedFile::create/modify helpers after the API change.
Continue r-a convergence on the request-readiness branch: - Bump `notify` 6 → 8.2 (rust-analyzer pin) - Add `dummy::DummyHandle` for builds without OS watching - Feature `server-file-watcher` (default on); wasm uses `vide` with default-features off so notify is not linked - Expand manifest exclude globs to directory prefixes in project-model; remove `exclude_globs` from loader::Directories - Keep FileSet PathMatcher for source-root classification
CI failed on `sources = ["rtl/*.sv"]`: after removing loader globs, recursive Directories under `rtl` incorrectly accepted nested files. - Expand non-`**` source globs to `Entry::Files` at config time - Keep `**` patterns as recursive directory loads with prefix excludes - Write files in the shell-separator semantics test so expansion works
Source attribution lives in module docs; a separate upstream pin file is not needed for this owned fork.
Keep short module docs and non-obvious behavior notes; drop fork narratives, outdated identity comments, and redundant restatements.
hongjr03
added a commit
that referenced
this pull request
Jul 15, 2026
FileId's field is private on master after #301; update tests and silence clippy too_many_arguments on snapshot/key constructors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vfs+vfs-notify): replace the self-grown implementation; pin upstream incrates/vfs/UPSTREAM.md.Progresscarriesconfig_version+LoadingProgressand gates readiness;Loaded/Changedcarry only file batches (no content generation token). Only Changed can trigger manifest auto-reload.Option<Vec<u8>>in VFS; line endings stay in the host map. Hardlink / path-identity redirects removed.notify8.2; OS watcher behind featureserver-file-watcher(default on). Dummy loader when the feature is off (wasm viadefault-features = false).Directoriesis r-a-shaped (include / exclude / extensions only). Manifest exclude globs → directory prefixes inproject-model; shallow source globs likertl/*.sv→Entry::Files. FileSet still uses PathMatcher for source-root classification.Root cause
Design
Cold path (
dispatch/request.rs)textDocument/diagnosticworkspace/diagnosticworkspace/symbolOn readiness: invalidate diagnostics and send
workspace/diagnostic/refreshwhen supported.VFS fork (
crates/vfs)dummy::DummyHandleDirectoriesLoader config (
project-model)rtl/excluded/**→ absolute exclude prefixes beforeset_config.**source globs at config time to file lists; keep**patterns as recursive directory loads.Review guide
src/global_state/dispatch/request.rs— cold terminal fallbackscrates/vfs/+UPSTREAM.md+dummy.rssrc/global_state.rs— notify vs dummy spawncrates/project-model— prefix / shallow-glob expansionevent_loop/process_changes— Progress readiness, Loaded vs ChangedValidation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test -p vfscargo test -p project-model --libcargo test -p vide --lib -- process_changes::tests main_loop::testscargo check -p vide --no-default-features/cargo check -p vide-lsp-wasm